# -*- mode: python; -*-

import os
Import('BuildEnv')
env = BuildEnv.Clone()

sources = [
    'MANIFEST.in',
    'setup.py',
    ]

sources += env.SandeshGenPy(
    'server_inventory.sandesh',
    'inventory_daemon/', False)

local_sources = [
	'__init__.py',
	]

local_sources_rules = []
for file in local_sources:
    local_sources_rules.append(env.Install(Dir("inventory_daemon"), file))

cd_cmd = 'cd ' + Dir('.').path + ' && '
sdist_gen = env.Command('dist',
                         sources+local_sources,
                         cd_cmd + 'python setup.py sdist')
env.Alias('controller/src/inventory:sdist', sdist_gen)
env.Default(sdist_gen)

if 'install_contrail_sm_inventory' in BUILD_TARGETS:
    env.Alias('install_contrail_sm_inventory',
              env.Command(None, sources+local_sources,
                          cd_cmd + 'python setup.py install %s' %
                          env['PYTHON_INSTALL_OPT']))
